import React, { PureComponent } from 'react'

export class App extends PureComponent {
  constructor() {
    super()
    this.state = {
      titleColor: 'red',
      fontSize: 30
    }
  }

  enlargeFont() {
    this.setState({ fontSize: this.state.fontSize+2 })
  }
  render() {
    const {titleColor, fontSize} = this.state
    return (
      <>
      <div style={{color:titleColor,fontSize:fontSize}}>App</div>
      <button onClick={() => this.enlargeFont()}>放大字体</button>
      </>
    )
  }
}

export default App